<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>

<c:set var="url_context" value="${pageContext.request.contextPath}" scope="application" />
<c:set var="url_style" value="${url_context}/styles" scope="application" />
<c:set var="url_script_lib" value="${url_context}/script/js-libraries" scope="application" />

<html>

	<head>
		<script type="text/javascript" src="${url_script_lib}/jquery-1.7.2.js"></script>
		
		<!-- BOOTSTRAP -->
    	<link href="${url_context}/bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
		
	</head>
	<body class="tinybox">
		
		<div class="wrapper">
			<form:form class="photo-upload" enctype="multipart/form-data" method="POST" commandName="patient" action="${url_context}/upload-patient-photo.jspx?patientId=${patient.id}">
				<c:if test="${param.formsubmitsuccess}">
					<div class="alert alert-success"><strong>Hooray!</strong> Your changes has been saved!</div>
				</c:if>
				<spring:bind path="patient.*">
					<c:if test="${status.error}">
						<div class='alert alert-error'>
							<strong>Oh snap! </strong>
							<form:errors path="*" />
			            </div>
					</c:if>
				</spring:bind>
				<div class="pull-left">
					<img class="preview-image img-polaroid" height="200" width="200" src="${url_context}/patient-image.jspx?patientId=${patient.id}&imageSize=large"/>
				</div>
					
				
				<div style="padding: 10px; width: 340px; margin-left: 10px;" class="pull-left">
					<h4>Update existing patient picture</h4>
					<hr/>
					<input type="file" id="photo" name="photo" accept="image/*" required/>
					
					<div class="note">Profile image must be at least 250 x 250 pixels and must not exceed 10Mb</div>
					<br/>
					
					<input type="submit" class="btn btn-primary" value="Upload"/>
				</div>
				
			</form:form>
		</div>
		<script>
		$(document).ready(function() {
			
			
			
			window.parent.jQuery('.tclose').click(function() {
				window.parent.location.reload();
			});
		});
		</script>
	</body>

</html>